import request from '@/utils/request'
import { projectApiUrlList, producerApisUrl } from '../config'

/**
 * 项目产值记录分页
 * @param data
 */
export function getProjectOutputList(data) {
  return request({
    url: projectApiUrlList + '/output/query-tree',
    method: 'post',
    data: data
  })
}

/**
 * 导出
 * @param data
 */
export function exportDatas(data) {
  return request({
    url: projectApiUrlList + '/project-output-value/export-excel',
    method: 'get',
    params: data
  })
}


/**
 * 项目产值列表
 * @param parameter
 */
export function getProjectOutputValueInfo(parameter) {
  return request({
    url: projectApiUrlList + '/project-output-value/info',
    method: 'get',
    params: parameter
  })
}


/**
 * 项目产值记录详情
 * @param data
 */
export function getOutputValueDetails(data) {
  return request({
    url: projectApiUrlList + '/project-output-value/details',
    method: 'get',
    params: data
  })
}


/**
 *  项目产值信息录入
 * @param data
 */
export function addOutputValue(data) {
  return request({
    url: projectApiUrlList + '/project-output-value',
    method: 'post',
    data: data
  })
}


/**
 * 查询基础信息详情
 * @param data
 */
export function getOutputBasic(data) {
  return request({
    url: projectApiUrlList + '/output/basic/' + data.id,
    method: 'get',
    params: data
  })
}

/**
 * 查询年度产值
 * @param data
 */
export function getOutputYear(data) {
  return request({
    url: projectApiUrlList + '/output/year/' + data.id,
    method: 'get',
    params: data
  })
}

/**
 * 查询年度产值详情(根据年度产值id)
 * @param data
 */
export function getOutputYearDetail(data) {
  return request({
    url: projectApiUrlList + '/output/year/detail/' + data.id,
    method: 'get',
    params: data
  })
}

/**
 * 录入年度产值
 * @param data
 */
export function getOutputYearInputYear(data) {
  return request({
    url: projectApiUrlList + '/output/input/year',
    method: 'post',
    data
  })
}

/**
 * 月度产值信息分页
 * @param data
 */
export function getOutputMonthList(data) {
  return request({
    url: projectApiUrlList + '/output/month/list',
    method: 'post',
    data
  })
}

/**
 * 月度产值信息详情(根据月度产值id)
 * @param data
 */
export function getOutputMonthDetail(data) {
  return request({
    url: projectApiUrlList + '/output/month/detail/' + data.id,
    method: 'get',
    params: data
  })
}

/**
 * 录入月度产值
 * @param data
 */
export function getOutputMonth(data) {
  return request({
    url: projectApiUrlList + '/output/input/month',
    method: 'post',
    data
  })
}

/**
 * 修正人数
 * @param data
 */
export function correctedPersonNumber(data) {
  return request({
    url: projectApiUrlList + '/output/correctedPersonNumber',
    method: 'post',
    data
  })
}

/**
 * 调整计划产值
 * @param data
 */
export function adjustPlanOutputValue(data) {
  return request({
    url: projectApiUrlList + '/output/adjustPlanOutputValue',
    method: 'post',
    data
  })
}

/**
 * 目标产值列表
 * @param data
 */
export function queryYearTargetList(data) {
  return request({
    url: projectApiUrlList + '/yearTarget/outputValue/query',
    method: 'post',
    data
  })
}

/**
 * 目标产值新增
 * @param data
 */
export function createYearTarget(data) {
  return request({
    url: projectApiUrlList + '/yearTarget/outputValue/create',
    method: 'post',
    data
  })
}

/**
 * 目标产值修改
 * @param data
 */
export function editYearTarget(data) {
  return request({
    url: projectApiUrlList + '/yearTarget/outputValue/edit',
    method: 'post',
    data
  })
}

/**
 * 目标产值查询已有年份
 * @param data
 */
export function queryYearTargetYearList(data) {
  return request({
    url: projectApiUrlList + '/yearTarget/outputValue/queryYear',
    method: 'get'
  })
}
/**
 * 目标产值详情查询
 * @param id
 */
export function queryYearTargetDetail(id) {
  return request({
    url: projectApiUrlList + '/yearTarget/outputValue/detail/' + id,
    method: 'get'
  })
}

/**
 * 目标产值分公司数据查询（传参为列表id）
 * @param id
 */
export function queryYearTargetBranchDetail(id) {
  return request({
    url: projectApiUrlList + '/yearTarget/outputValue/branch/' + id,
    method: 'get'
  })
}

/**
 * 年度计划项目产值记录查询
 * @param data
 */
export function queryProjectOutput(data) {
  return request({
    url: projectApiUrlList + '/yearPlan/outputValue/queryProjectOutput',
    method: 'post',
    data
  })
}
/**
 * 年度计划新增
 * @param data
 */
export function createYearPlan(data) {
  return request({
    url: projectApiUrlList + '/yearPlan/outputValue/create',
    method: 'post',
    data
  })
}
/**
 * 年度计划编辑或变更
 * @param data
 */
export function editYearPlan(data) {
  return request({
    url: projectApiUrlList + '/yearPlan/outputValue/edit',
    method: 'post',
    data
  })
}
/**
 * 年度计划详情
 * @param id
 */
export function yearPlanDetail(data) {
  return request({
    url: projectApiUrlList + '/yearPlan/outputValue/detail',
    method: 'post',
    data
  })
}
/**
 * 年度计划列表
 * @param data
 */
export function queryYearPlanList(data) {
  return request({
    url: projectApiUrlList + '/yearPlan/outputValue/query',
    method: 'post',
    data
  })
}
/**
 * 查询已有目标产值的年份（根据分公司id）
 * @param id
 */
export function queryYearBybranchId(id) {
  return request({
    url: projectApiUrlList + '/yearPlan/outputValue/queryYear/' + id,
    method: 'get'
  })
}
/**
 * 查询计划产值版本记录
 * @param id
 */
export function queryYearVersionRecord(id) {
  return request({
    url: projectApiUrlList + '/yearPlan/outputValue/queryVersionRecord/' + id,
    method: 'post'
  })
}
/**
 * 项目产值统计树形-列表
 * @param data
 */
export function queryOutputValueStatistics(data) {
  return request({
    url: projectApiUrlList + '/outputValue/statistics/query-tree',
    method: 'post',
    data
  })
}

/**
 * 项目产值统计修正人数
 * @param data
 */
export function correctedPersonNumberStatistics(data) {
  return request({
    url: producerApisUrl + '/projectOutputValueStatistics/correctedPersonNumber',
    method: 'post',
    data
  })
}

// 导出快报
export function planOutputValueexcelFourExport(params) {
  return request({
    url: producerApisUrl + '/planOutputValueexcelFour/export',
    method: 'get',
    responseType: 'arraybuffer',
    params
  })
}

// 导出公司汇总数据
export function planOutputValueexcelExport(params) {
  return request({
    url: producerApisUrl + '/total/outputValue/excel/export-branch',
    method: 'get',
    responseType: 'arraybuffer',
    params
  })
}
/**
 * 导出基础产值数据（按月导出列表所有项目）
 * @param data
 */
export function outputEexportBase(data) {
  return request({
    url: projectApiUrlList + '/output/export-base',
    method: 'post',
    data
  })
}
/**
 * 导出公司年度计划公司
 * @param data
 */
export function exportCompany(data) {
  return request({
    url: producerApisUrl + '/yearPlan/outputValue/excel/export-company',
    method: 'get',
    params: data,
    responseType: 'blob'
  })
}
/**
 * 导出公司年度计划分公司
 * @param data
 */
export function exportBranch(data) {
  return request({
    url: producerApisUrl + '/yearPlan/outputValue/excel/export-branch',
    method: 'get',
    params: data,
    responseType: 'blob'
  })
}